var t = require;
var e = module;
var o = exports;
var _n5,
    i =
        (this && this.__extends) ||
        ((_n5 = function n(t, e) {
            return (_n5 =
                Object.setPrototypeOf ||
                ({ __proto__: [] } instanceof Array &&
                    function (t, e) {
                        t.__proto__ = e;
                    }) ||
                function (t, e) {
                    for (var o in e) {
                        Object.prototype.hasOwnProperty.call(e, o) && (t[o] = e[o]);
                    }
                })(t, e);
        }),
            function (t, e) {
                function o() {
                    this.constructor = t;
                }
                _n5(t, e), (t.prototype = null === e ? Object.create(e) : ((o.prototype = e.prototype), new o()));
            }),
    s =
        (this && this.__decorate) ||
        function (t, e, o, n) {
            var i,
                s = arguments.length,
                r = s < 3 ? e : null === n ? (n = Object.getOwnPropertyDescriptor(e, o)) : n;
            if (
                "object" == (typeof Reflect === "undefined" ? "undefined" : typeof Reflect) &&
                "function" == typeof Reflect.decorate
            )
                r = Reflect.decorate(t, e, o, n);
            else
                for (var c = t.length - 1; c >= 0; c--) {
                    (i = t[c]) && (r = (s < 3 ? i(r) : s > 3 ? i(e, o, r) : i(e, o)) || r);
                }
            return s > 3 && r && Object.defineProperty(e, o, r), r;
        };
Object.defineProperty(o, "__esModule", { value: !0 });
var r = cc._decorator,
    c = r.ccclass,
    a = r.property,
    u = t("BaseUI"),
    l = t("UIEnum"),
    d = t("UIManager"),
    p = t("SDK"),
    h = (function (t) {
        function e() {
            var e = (null !== t && t.apply(this, arguments)) || this;
            return (
                (e.childNode = null),
                (e.restartBtn = null),
                (e.shareBtn = null),
                (e.homeBtn = null),
                (e.areaCountLabel = null),
                (e.successLabel = null),
                (e.failLabel = null),
                (e.successNode = null),
                (e.failNode = null),
                (e.btnsNode = null),
                (e.gressNode = null),
                (e.gressBar = null),
                (e.gressLabel = null),
                (e.textBgNode = null),
                (e.textsNode = null),
                (e.dyBtn = null),
                (e.gameBtn = null),
                (e.tuiguangNode = null),
                (e.game = null),
                e
            );
        }
        return (
            i(e, t),
            (e.prototype.onLoad = function () {
                var t = this,
                    e = this;
                p.default.isTT()
                    ? ((this.gameBtn.active = !0), tt.getSystemInfoSync().appName, (this.dyBtn.active = !1))
                    : ((this.gameBtn.active = !1), (this.dyBtn.active = !1)),
                    0 == this.gameBtn.active && 0 == this.dyBtn.active && (this.tuiguangNode.active = !1),
                    this.restartBtn.on(
                        cc.Node.EventType.TOUCH_END,
                        function (e) {
                            t.game.restart(), t.hide(), e.stopPropagation();
                        },
                        this
                    ),
                    this.shareBtn.on(
                        cc.Node.EventType.TOUCH_END,
                        function (t) {
                            p.default.shareRecorder({
                                success: function success() {
                                    (e.shareBtn.active = !1), e.game.sendEvent("failShareVideo");
                                },
                                query: ""
                            }),
                                t.stopPropagation();
                        },
                        this
                    ),
                    this.homeBtn.on(
                        cc.Node.EventType.TOUCH_END,
                        function (e) {
                            t.game.backHome(), t.hide(), e.stopPropagation();
                        },
                        this
                    );
            }),
            (e.prototype.moreGame = function () {
                this.game.showMoreGame();
            }),
            (e.prototype.follow = function () {
                this.game.jumpToDy();
            }),
            (e.prototype.hide = function () {
                (this.game._zanting = !1), d.UIMgr.hide(l.default.FailUI, !1, !0);
            }),
            (e.prototype.init = function (t) {
                this.game = t;
            }),
            (e.prototype.onShow = function () {
                var t = this;
                (this.node.active = !0),
                    (this.childNode.scale = 0),
                    cc
                        .tween(this.childNode)
                        .to(0.3, { scale: 1 })
                        .call(function () {
                            cc.tween(t.textBgNode).to(2, { width: 740 }).start(),
                                cc
                                    .tween(t.textsNode)
                                    .to(2, { width: 700 })
                                    .call(function () {
                                        cc.tween(t.successNode)
                                            .to(0.5, { scale: 1 })
                                            .call(function () {
                                                cc.tween(t.failNode)
                                                    .to(0.5, { scale: 1 })
                                                    .call(function () {
                                                        cc.tween(t.gressNode)
                                                            .to(0.5, { scale: 1 })
                                                            .call(function () {
                                                                (t.btnsNode.active = !0), p.default.playScreen();
                                                            })
                                                            .start();
                                                    })
                                                    .start();
                                            })
                                            .start();
                                    })
                                    .start();
                        })
                        .start(),
                    p.default.getRecorderTime() > 5e3 && !p.default.getRecorderState()
                        ? (this.shareBtn.active = !0)
                        : (this.shareBtn.active = !1);
                var e = this.game.currentTextNum,
                    o = this.game.totalTextNum - this.game.currentTextNum;
                (this.failLabel.string = e + ""),
                    (this.successLabel.string = o + ""),
                    (this.gressBar.progress = o / this.game.totalTextNum),
                    (this.gressLabel.string = Math.floor((o / this.game.totalTextNum) * 100) + "%");
                var n = this.game.getLanguage("label_area_tips");
                (n = n.replace("#{count}", this.game.indexUI.myRegionCount)),
                    (this.areaCountLabel.string = n),
                    (this.textBgNode.width = 40),
                    (this.textsNode.width = 40),
                    (this.successNode.scale = 0),
                    (this.failNode.scale = 0),
                    (this.btnsNode.active = !1),
                    (this.gressNode.scale = 0);
                for (var i = this.game.textsNode.children, s = i.length - 1; s >= 0; s--) {
                    i[s].parent = this.textsNode;
                }
                (this.game._zanting = !0),
                    3 == this.game.currentChapter
                        ? ((this.textBgNode.height = 280), (this.textsNode.height = 320))
                        : ((this.textBgNode.height = 200), (this.textsNode.height = 180));
            }),
            (e.prototype.onEnable = function () {
                p.default.showBanner();
            }),
            (e.prototype.onDisable = function () {
                p.default.isTT() && p.default.hideBanner();
            }),
            (e.prototype.start = function () { }),
            s([a(cc.Node)], e.prototype, "childNode", void 0),
            s([a(cc.Node)], e.prototype, "restartBtn", void 0),
            s([a(cc.Node)], e.prototype, "shareBtn", void 0),
            s([a(cc.Node)], e.prototype, "homeBtn", void 0),
            s([a(cc.Label)], e.prototype, "areaCountLabel", void 0),
            s([a(cc.Label)], e.prototype, "successLabel", void 0),
            s([a(cc.Label)], e.prototype, "failLabel", void 0),
            s([a(cc.Node)], e.prototype, "successNode", void 0),
            s([a(cc.Node)], e.prototype, "failNode", void 0),
            s([a(cc.Node)], e.prototype, "btnsNode", void 0),
            s([a(cc.Node)], e.prototype, "gressNode", void 0),
            s([a(cc.ProgressBar)], e.prototype, "gressBar", void 0),
            s([a(cc.Label)], e.prototype, "gressLabel", void 0),
            s([a(cc.Node)], e.prototype, "textBgNode", void 0),
            s([a(cc.Node)], e.prototype, "textsNode", void 0),
            s([a(cc.Node)], e.prototype, "dyBtn", void 0),
            s([a(cc.Node)], e.prototype, "gameBtn", void 0),
            s([a(cc.Node)], e.prototype, "tuiguangNode", void 0),
            s([c], e)
        );
    })(u.default);
o.default = h;
